package com.pray.praymall.product.vo;

import com.pray.praymall.product.entity.SkuImagesEntity;
import com.pray.praymall.product.entity.SkuInfoEntity;
import com.pray.praymall.product.entity.SpuInfoDescEntity;
import lombok.Data;
import lombok.ToString;

import java.util.List;

/**
 * 商品详情页Vo
 *
 * @author 魂悸魄
 * @date 2020/9/19 14:27
 */
@Data
public class SkuItemVo {
    // 1、sku基本信息获取，pms_sku_info
    private SkuInfoEntity info;
    // 2、sku的图片信息，pms_sku_images
    List<SkuImagesEntity> images;
    // 3、获取spu的销售属性组合
    private List<SkuItemSaleAttrVo> saleAttr;
    // 4、获取spu的介绍
    private SpuInfoDescEntity desc;
    // 5、获取spu的规格参数信息
    private List<SpuItemAttrGroupVo> groupAttrs;

    private boolean hasStock = true;

    @ToString
    @Data
    public static class SkuItemSaleAttrVo {
        /**
         * 属性id
         */
        private Long attrId;
        /**
         * 属性名
         */
        private String attrName;

        /**
         * 属性对应的所有值
         */
        private List<AttrValueWithSkuIdVo> attrValues;

        @Data
        public static class AttrValueWithSkuIdVo {
            private String attrValue;
            private String skuIds;
        }
    }


    @ToString
    @Data
    public static class SpuItemAttrGroupVo {
        private String groupName;
        private List<SpuBaseAttrVo> attrs;
    }

    @ToString
    @Data
    public static class SpuBaseAttrVo {
        /**
         * 属性名
         */
        private String attrName;
        /**
         * 属性值
         */
        private String attrValue;
    }
}
